import sys

from plugins.plugin import Plugin

sys.path.append("..")

from src.video import Video
from src.config import Config
from src.history import History

class PHistory(Plugin):

    def __init__(self, history: History=History(), config: Config=Config()) -> None:
        super().__init__(history, config)

        self.history = history
        self.config = config

        self.name = "[+] History"
        self.category = "History"

        self.query_description = """"""

        self.params = {}

        self.flag = "-h"
        self.full_flag = "--history"
        self.flag_help = "show roseng history list"
        self.flag_action = "store_true"
        
        self.config = Config()

    def get_history(self):
        videos = list()
        for video in self.history.video_list:
            video.isWatched = True
            videos.append(video.to_json())

        return videos

    def get_items(self, params):
        return self.get_history()


